﻿-- -----------------------------------------------------------------------------
-- | WonderTek [ 网络无处不在，沟通及时到达 ]
-- -----------------------------------------------------------------------------
-- | Copyright (c) 2013, WonderTek, Inc. All Rights Reserved.
-- -----------------------------------------------------------------------------
-- | Author: hewu <hewu@gmail.com>
-- -----------------------------------------------------------------------------
-- @class ArPlugin
-- @note 增强现实Lua接口
-- -----------------------------------------------------------------------------

ArPlugin = {}

Reg.g_ArPlugin = 'g_ArPlugin'

--[[
 -------------------------------------------------------------------------------
 -- @function ArPlugin:_getHandle()
 -------------------------------------------------------------------------------
 -- @brief 获取ArPlugin插件句柄
 -------------------------------------------------------------------------------
 -- @access private
 -------------------------------------------------------------------------------
 -- @param 无
 -------------------------------------------------------------------------------
 -- @return number
 -------------------------------------------------------------------------------
 --]]
function ArPlugin:_getHandle()
    local reg = registerCreate(Reg.g_ArPlugin)
    local handle = registerGetInteger(reg, 'ArPlugin')
    if handle == 0 then
        handle = pluginCreate('ArPlugin')
        registerSetInteger(reg, 'ArPlugin', handle)
    end
    return handle
end


--[[
 -------------------------------------------------------------------------------
 -- @function ArPlugin:start()
 -------------------------------------------------------------------------------
 -- @brief 开启增强现实功能
 -------------------------------------------------------------------------------
 -- @access public
 -------------------------------------------------------------------------------
 -- @param 无
 -------------------------------------------------------------------------------
 -- @return 无
 -------------------------------------------------------------------------------
 --]]
function ArPlugin:start()
    pluginInvoke(self:_getHandle(), "StartArPlugin", "Dominoes")
end